const { DataTypes } = require('sequelize')

const seq = require('../db/seq')

// 创建模型(Model zd_user -> 表 zd_users)
const User = seq.define('users', {
  // id 会被sequelize自动创建, 管理
  username: {
    type: DataTypes.STRING,
    allowNull: false,
    unique: true,
    comment: '用户名, 唯一',
  },
  password: {
    type: DataTypes.STRING,
    allowNull: false,
    unique: true,
    comment: '密码',
  },
  id: {
    type: DataTypes.INTEGER,
    allowNull: false,
    unique: true,
    primaryKey:true,
    autoIncrement: true, 
    comment: '用户id',
  },
})

// 强制同步数据库(创建数据表)
// User.sync({ force: true })

module.exports = User